Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

issues/170: Fixed message serial out of sync after recover #175

Merged
merged 3 commits into from
Oct 6, 2016

Conversation

trenouf
Copy link
Contributor

@trenouf trenouf commented Oct 6, 2016

Also protocol message logging.

Copy link
Member

@mattheworiordan mattheworiordan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@trenouf
Copy link
Contributor Author

trenouf commented Oct 6, 2016

This change might still be wrong. Paddy and I are discussing.

@trenouf
Copy link
Contributor Author

trenouf commented Oct 6, 2016

What do you reckon to that Paddy?

Copy link
Member

@paddybyers paddybyers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM but pls see comments.

@@ -271,6 +272,7 @@ public void run() {
***************************************/

public void onMessage(ProtocolMessage message) throws AblyException {
Log.v(TAG, "onMessage(): " + new String(ProtocolSerializer.writeJSON(message)));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't like the way that this serialises every message even though the log level doesn't require it to be emitted. I think it has to be done conditionally on the log level, or the log API has to take a format string and arguments so expansion is under control of the logger.

* connection, and thus one more than the highest message serial
* in the queue.
*/
public synchronized void reset(long oldMsgSerial) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think reset() should take an ErrorInfo argument and pass that to the nack, and then the specific error is determined by whoever calls reset(). There will be different situations that will require different error messages/codes.

Tim Renouf added 3 commits October 6, 2016 15:13
#170
had a problem where reeonnection from suspended and explicit channel
recovery stops CompletionListener.onSuccess() being called for messages
published after that.

The problem was that the message serial in ConnectionManager and
PendingMessageQueue got out of sync -- only the former was reset back to
0, so then PendingMessageQueue got confused by the message serial in an
ack after a publish, and the callback was not called.

Fixed by ensuring that msgSerial only gets reset when the connection id
changes on connect, and then the PendingMessageQueue is reset at the
same time. Also any pending messages (ones that have been sent but not
acked) at that time are failed.
#170

One test for the recover case that was broken, and one test for the
resume case that was probably not broken.
@trenouf
Copy link
Contributor Author

trenouf commented Oct 6, 2016

@paddy fixed your comments.

@paddybyers paddybyers merged commit 369383d into master Oct 6, 2016
@paddybyers
Copy link
Member

Thanks

@mattheworiordan mattheworiordan deleted the tpr/issue170 branch October 6, 2016 17:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants